import React,{Suspense} from 'react'
import { HashRouter as Router, Redirect, Route, Switch } from 'react-router-dom'
import {ConfigProvider,Spin} from 'antd'
import ZH_CN from 'antd/es/locale/zh_CN'
import 'antd/dist/antd.less'
const Home = React.lazy(() => import('pages/Home/index.jsx'));
const Login = React.lazy(() => import('pages/Login'));




class App extends React.Component {
  render() {
    return (
      <ConfigProvider locale={ZH_CN}>
          <Router>
          <Suspense fallback={ <div  className="loading-mask">
            正在加载中...<Spin size="large" />
        </div>}>
             <Switch>
                 <Route  path="/" exact render={() => <Redirect to={'/login'}/>}/>
                 <Route  path="/view" component={props => <Home {...props}/>}/>
                 <Route path="/login" component={props => <Login {...props}/>}/>
                 </Switch>
           </Suspense>
           </Router>
      </ConfigProvider>
    )
  }
}

export default App
